package cn.entity;

import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;

public class Users implements Serializable{
    private Integer id;
    @NotBlank(message = "用户名不能为空_server!")
    @Pattern(regexp = "^\\w{3,8}$",message = "用户名必须是3-8位_server")
    private String username;

    private String password;

    private String name;
    @NotBlank(message = "手机号不能为空_server!")
    @Pattern(regexp = "^\\d{11}$",message = "手机号必须是11位_server")
    private String phone;

    private String pic;

    private String address;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date birthday;

    private Integer role;

    private Integer isdel;

    public Users(Integer id, String username, String password, String name, String phone, String pic, String address, Integer role, Integer isdel) {
        this.id = id;
        this.username = username;
        this.password = password;
        this.name = name;
        this.phone = phone;
        this.pic = pic;
        this.address = address;
        this.role = role;
        this.isdel = isdel;
    }

    public Users() {
        super();
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username == null ? null : username.trim();
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password == null ? null : password.trim();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone == null ? null : phone.trim();
    }

    public String getPic() {
        return pic;
    }

    public void setPic(String pic) {
        this.pic = pic == null ? null : pic.trim();
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address == null ? null : address.trim();
    }

    public Integer getRole() {
        return role;
    }

    public void setRole(Integer role) {
        this.role = role;
    }

    public Integer getIsdel() {
        return isdel;
    }

    public void setIsdel(Integer isdel) {
        this.isdel = isdel;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
}